import { createStore, combineReducers, applyMiddleware } from 'redux';

// 使action可以执行异步函数
import thunk from 'redux-thunk';

// 接入 redux 插件
import { composeWithDevTools } from 'redux-devtools-extension';

// 导入项目reducer
import { login } from './reducers/login';
import { user } from './reducers/user';
import { article } from './reducers/article';

// 合并reducer
const rootReducer = combineReducers({ login, user, article });

// 初始化reducer
// const initialState = {
//   login: localStorage.getItem('geek-pc-token') || '',
// };

// 创建store
export const store = createStore(
  rootReducer,
  // initialState,
  composeWithDevTools(applyMiddleware(thunk))
);
